using UnityEngine;

public class GiftController : MonoBehaviour
{
	public GameObject[] bonus;

	public tk2dTextMesh texhMeshcoin;

	private int randomMau;

	private void Start()
	{
		randomMau = UnityEngine.Random.Range(0, 2);
		if (randomMau < 1)
		{
			bonus[0].SetActive(value: true);
			GameManager.BonusGift = 0;
			if (GameManager.key_stage <= 10)
			{
				texhMeshcoin.text = "1000";
				texhMeshcoin.Commit();
			}
			else if (GameManager.key_stage > 10 && GameManager.key_stage <= 20)
			{
				texhMeshcoin.text = "2000";
				texhMeshcoin.Commit();
			}
			else if (GameManager.key_stage > 20 && GameManager.key_stage <= 30)
			{
				texhMeshcoin.text = "3000";
				texhMeshcoin.Commit();
			}
			else if (GameManager.key_stage > 30 && GameManager.key_stage <= 40)
			{
				texhMeshcoin.text = "4000";
				texhMeshcoin.Commit();
			}
			else if (GameManager.key_stage > 40 && GameManager.key_stage <= 50)
			{
				texhMeshcoin.text = "5000";
				texhMeshcoin.Commit();
			}
			else
			{
				texhMeshcoin.text = "8000";
				texhMeshcoin.Commit();
			}
		}
		else
		{
			GameManager.BonusGift = 1;
			if (GameManager.key_stage <= 20)
			{
				bonus[1].SetActive(value: true);
			}
			else if (GameManager.key_stage > 20 && GameManager.key_stage <= 30)
			{
				bonus[2].SetActive(value: true);
			}
			else if (GameManager.key_stage > 30 && GameManager.key_stage <= 54)
			{
				bonus[3].SetActive(value: true);
			}
			else
			{
				bonus[4].SetActive(value: true);
			}
		}
	}
}
